package com.yanqu.road.server.cmd.activity.channelmusicroomrank;

import com.yanqu.road.message.YanQuMessage;

import com.yanqu.road.pb.activity.ChannelMusicRoomRankProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;

import com.yanqu.road.server.manager.activity.channelmusicroomrank.ChannelMusicRoomRankActivity;
import com.yanqu.road.server.manager.activity.channelmusicroomrank.CrossChannelMusicRoomRankActivityMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Cross3Protocol;

import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Cross3Protocol.C3_CHANNEL_MUSIC_ROOM_RANK_MAIN_SCENE, desc = "妙音坊冲榜 主界面")
public class CrossChannelMusicRoomRankMainSceneCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        ChannelMusicRoomRankProto.CrossChannelMusicRoomRankMainSceneReqMsg reqMsg = ChannelMusicRoomRankProto.CrossChannelMusicRoomRankMainSceneReqMsg.parseFrom(packet.getBytes());
        ChannelMusicRoomRankActivity activity = CrossChannelMusicRoomRankActivityMgr.getActivity(reqMsg.getActivityId());
        if (activity != null) {
            ChannelMusicRoomRankProto.ChannelMusicRoomRankMainSceneRespMsg.Builder mainSceneMsg = activity.getMainSceneMsg();
            MessageHelper.sendPacket(serverId, packet.getPlayerId(),
                    YanQuMessageUtils.buildMessage(ClientProtocol.U_CHANNEL_MUSIC_ROOM_RANK_MAIN_SCENE, mainSceneMsg.build()));
        }
    }

    @Override
    public void sendData() {

    }
}
